import re
from fontTools.ttLib import TTFont

font = TTFont('./sz-58.ttf')
cmap = font.get("cmap").getBestCmap()
ttf_dict = dict()
for k, v in cmap.items():
    # print(k, v)
    # print(hex(k), v)
    # print(hex(k), int(re.search(r"\d+", v).group(0)))
    new_dict_k = hex(k)
    new_dict_v = int(re.search(r"\d+", v).group(0))
    ttf_dict[new_dict_k] = new_dict_v

print("解析后：", ttf_dict)
